<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>pattern属性</title>
</head>
<body>
    <form id="form">
        <fieldset>
            <legend>pattern属性</legend>
            用户名：<input type="text" name="username" pattern="^[a-zA-Z]\w{5,7}$">
            <input type="submit" value="提交">
            <p>
                包含字母，不区分大小写，长度在5~7
            </p>
        </fieldset>
    </form>
</body>
</html>